/*!
\copyright  Copyright (c) 2025 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\ingroup    user_eq
\brief      API to trigger UserEQ notification

*/

#include "user_eq_notification.h"
#include <user_eq.h>
#include <task_list.h>
#include <panic.h>

static task_list_t *listeners;

void UserEq_NotificationInit(void)
{
    listeners = TaskList_Create();
}

void UserEq_RegisterNotificationListener(Task task)
{
    TaskList_AddTask(listeners, task);
}

void UserEq_NotificationEqIsAvailable(bool is_available)
{
    TaskList_MessageSendId(listeners, is_available ? USER_EQ_AVAILABLE : USER_EQ_UNAVAILABLE);
}

void UserEq_NotificationBandsUpdated(uint8 start_band, uint8 end_band)
{
    USER_EQ_BANDS_UPDATED_T *message = PanicUnlessMalloc(sizeof(USER_EQ_BANDS_UPDATED_T));
    message->start_band = start_band;
    message->end_band = end_band;
    TaskList_MessageSendWithSize(listeners, USER_EQ_BANDS_UPDATED, message, sizeof(USER_EQ_BANDS_UPDATED_T));  
}